package com.slz3.business.module.memberManagement.memJifen.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.memberManagement.memJifen.domain.MemJifen;
import com.slz3.business.module.memberManagement.memJifen.domain.MemJifenFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MemJifenTransactionalServiceImpl implements MemJifenTransactionalService {

    @Override
    public MemJifen modify(MemJifen memJifenNew) {
        Repositorys.memJifen.test();
        Repositorys.memJifen.save(MemJifenFactory.initBaseFields());
        System.err.println(1/0);
        memJifenNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.memJifen.saveAndFlush(memJifenNew);
    }

    @Override
    public List<MemJifen> batchModify(List<MemJifen> memJifenList) {
        return Repositorys.memJifen.saveAll(memJifenList);
    }
}
